SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO








CREATE Procedure [dbo].[SP_TTDOCU_CNTB_Q02]
@INNU_STAT TD_IN_001,
@ISTI_DOCU TD_VC_003 OUTPUT

as

If @INNU_STAT = 1
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0001 = 'S'

If @INNU_STAT = 2
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0002 = 'S' 

If @INNU_STAT = 3
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0003 = 'S' 

If @INNU_STAT = 4
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0004 = 'S'

If @INNU_STAT = 5
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0005 = 'S' 

If @INNU_STAT = 6
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0006 = 'S' 

If @INNU_STAT = 7
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0007 = 'S' 

If @INNU_STAT = 8
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0008 = 'S' 

If @INNU_STAT = 9
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0009 = 'S' 

If @INNU_STAT = 10
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB 
   Where ST_DOCU_0010 = 'S' 

If @INNU_STAT = 11
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0011 = 'S' 

If @INNU_STAT = 12
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0012 = 'S' 

If @INNU_STAT = 13
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0013 = 'S' 

If @INNU_STAT = 14
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0014 = 'S' 

If @INNU_STAT = 15
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0015 = 'S' 

If @INNU_STAT = 16
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0016 = 'S' 

If @INNU_STAT = 17
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0017 = 'S' 

If @INNU_STAT = 18
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0018 = 'S' 

If @INNU_STAT = 19
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0019 = 'S' 

If @INNU_STAT = 20
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0020 = 'S' 

If @INNU_STAT = 21
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0021 = 'S' 

If @INNU_STAT = 22
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0022 = 'S' 

If @INNU_STAT = 23
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0023 = 'S' 

If @INNU_STAT = 24
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0024 = 'S' 

If @INNU_STAT = 25
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0025 = 'S' 

If @INNU_STAT = 26
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB  
   Where ST_DOCU_0026 = 'S' 

If @INNU_STAT = 27
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0027 = 'S' 

If @INNU_STAT = 28
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0028 = 'S' 

If @INNU_STAT = 29
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0029 = 'S' 

If @INNU_STAT = 30
   Select  @ISTI_DOCU = TI_DOCU
   From TTDOCU_CNTB
   Where ST_DOCU_0030 = 'S'
-----------------------------------------------------------
-- Type: Stored Procedure
-- Name: SP_TTINTE_CNTB_I01
-----------------------------------------------------------


GO
